package com.hysf.utils;

import com.hysf.pojo.OpRecord;
import com.hysf.pojo.OpType;
import org.springframework.jdbc.core.RowMapper;

import java.sql.ResultSet;
import java.sql.SQLException;

public class OpRecordRowMapper implements RowMapper<OpRecord> {
	@Override
	public OpRecord mapRow(ResultSet rs, int rowNum) throws SQLException {
		OpRecord opRecord = new OpRecord();
		opRecord.setAccountid(rs.getInt("accountid"));
		opRecord.setOpmoney(rs.getDouble("opmoney"));
		opRecord.setOptime(String.valueOf(rs.getTime("optime")));
		opRecord.setOptype(OpType.valueOf(rs.getString("optype").toUpperCase()));
		opRecord.setTransferid(rs.getInt("transferid"));
		return opRecord;
	}
}
